-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add $unset and $geoNear stages #998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - found a few minor nits
driver-core/src/main/com/mongodb/client/model/GeoNearOption.java
Outdated
Show resolved
Hide resolved
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assumptions.assumeTrue; | ||
|
||
public class AggregatesTest extends OperationFunctionalSpecification { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not mix groovy spock specs into junit tests, which by extending: OperationFunctionalSpecification
we are. Good news is the setup and cleans are simple enough to be ported as they all originate from Java classes.
I would recommend adding a base java test class and / or registering an extension (similar to mongo-kafka/MongoDBHelper).
driver-core/src/test/functional/com/mongodb/client/model/AggregatesTest.java
Outdated
Show resolved
Hide resolved
driver-core/src/test/functional/com/mongodb/client/model/AggregatesTest.java
Outdated
Show resolved
Hide resolved
driver-scala/src/main/scala/org/mongodb/scala/model/Aggregates.scala
Outdated
Show resolved
Hide resolved
driver-core/src/main/com/mongodb/client/model/GeoNearOption.java
Outdated
Show resolved
Hide resolved
* | ||
* @since 4.8 | ||
*/ | ||
public final class GeoNearOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a new pattern for Aggregates builder methods. Looking at what we have currently, there is BucketOptions, BucketAutoOptions, GraphLookupOptions, UnwindOptions, MergeOptions, etc. all of which have a different design.
What's the rationale for diverging here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
* @mongodb.server.release 4.2 | ||
* @since 4.8 | ||
*/ | ||
public static Bson unset(final String... fields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a public static Bson unset(final List<String> fields)
version as well - this keeps it inline with other helpers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
import org.bson.codecs.configuration.CodecRegistry; | ||
import org.bson.conversions.Bson; | ||
|
||
class SimplePipelineStage implements Bson { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be more inclined to revert this change and just add
<suppress checks="FileLength" files="Aggregates"/>
to config/checkstyle/suppressions.xml
. Just because it's hard to justify why this one should move but not all the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor nits - then LGTM
|
||
@Override | ||
public String toString() { | ||
return "Stage{name='$densify'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: $geoNear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good eye
@@ -75,12 +75,20 @@ import static com.mongodb.internal.operation.OperationUnitSpecification.getMaxWi | |||
|
|||
class OperationFunctionalSpecification extends Specification { | |||
|
|||
def setup() { | |||
void setup() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this change can be reverted.
Also use Java tests instead of groovy.
JAVA-4594